<style type="text/css">
.weui_cells_radio .weui_check:checked + .weui_icon_checked:before {
  color: #cdab6a;
}
.weui_cells_radio2 .weui_check:checked + .weui_icon_checked:before {
  color: #cdab6a;
}
.jylabel-switch {
    padding: 0.2rem 0;
}
.jylabel-switch.active {
    background-color: #cdab6a;
}
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category .ul{margin:0; padding:0; width:100%;}
.parent-category .ul .li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category .ul .li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category .ul .li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.parent-category .ul .li.active a{color:#db232b;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category .ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category .ul .li{text-align:left; height: 32px; line-height: 32px; padding-left: 15px}
.children-category .ul .li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: 0.6rem; color: #ff2d4b}
.children-category .ul .li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category .ul .li a span{font-size: 0.6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:0.6rem;}
.fui-navbar .buybtn  {padding-left:0.2rem;background:#fff}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:2rem;color:#fff;width:auto;font-weight:400;font-size:0.75rem;margin:0.2rem 0;padding: 0 0.5rem}
.fee-tagup {background:#e7bf82;color:#fff;width:auto;font-weight:400;font-size:0.6rem}
.fee-tag-nav {background:#e7bf82;}
.fee-tagup-nav {background:#e7bf82;}

</style>
<div class="fui-page order-create-page fui-page-current">
	<div class="fui-content" style="background:#fff">
		<div ng-include="sys_html('shop/_map')"></div>
		<div class="fui-cellone">
		<div class="fui-cellone-info">
		<div class="col-jy jylabel jylabel-switch-label">
			<div class="col-jy-2">
				<div class="jylabel-switch {{pagedata.post.type!=1?'active':''}}" style="width:100%;font-size:0.75rem" ng-click="pagedata.post.type=0">立马维修</div>
			</div>
			<div class="col-jy-2">
				<div class="jylabel-switch {{pagedata.post.type==1?'active':''}}" style="width:100%;font-size:0.75rem" ng-click="pagedata.post.type=1">预约维修</div>
			</div>
		</div>
		</div>
		</div>
		<div class='fui-cellone' ng-click="pagedata.showserves=true;tool.get_list('jy_mapfuwu/index/getserve/',true);">
			<div class='fui-cellone-label bold' style="width:auto;margin-right:0.5rem"><i class="icon icon-jia"></i> 选择项目</div>
			<div class="fui-cellone-info"></div>
			<div class="fui-cellone-remark">
					<span ng-if="pagedata.total>0">已选择{{pagedata.total}}个项目</span>
			</div>
		</div>
		<div class='fui-cellone' ng-click="tool.choose_location(pagedata.post,'address','address')">
			<div class='fui-cellone-label bold' style="width:auto;margin-right:0.5rem"><i class="icon icon-map"></i> 选择位置</div>
			<div class="fui-cellone-info r"><input id="address" placeholder="上门地址" value="{{pagedata.post.address}}" class="weui_input" type="text"/></div>
			<div class="fui-cellone-remark"></div>
		</div>
		<div ng-if="pagedata.post.type==1" class='fui-cellone'>
			<div class='fui-cellone-label bold' style="width:auto"><i class="icon icon-shijian"></i> 选择预约时间</div>
			<div class="fui-cellone-info r">日期:
				<select ng-model="pagedata.post.day">
					<option ng-repeat="(key,value) in pagedata.days" value="{{value}}">{{value}}</option>
				</select>
			</div>
			<div class="fui-cellone-remark noremark" style="margin-left:0.5rem">
				<select ng-model="pagedata.post.time">时间：
					<option ng-repeat="(key,value) in pagedata.times" value="{{value}}">{{value}}</option>
				</select>
			</div>
		</div>
		<div class="weui_btn_area">
			<a class="weui_btn weui_btn_primary" style="background:#cdab6a;" href="javascript:" ng-click="pagedata.fuwupost()">提交订单</a>
		</div>
	</div>
</div>
<div ng-if="(pagedata.isorder.id && pagedata.showorder) || pagedata.showwait" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" style="top: 105%;font-size:1rem;" ng-click="pagedata.showwait=false"></i>
			<div class="fui-cell-group" style="background:none;padding:2rem">
			<div class="fui-title-c">
				<i class="icon jinyunicon icon-shijian" style="color:#666;font-size:2rem"></i>
				<div ng-if="!pagedata.isjiedan && (pagedata.isorder.status==0 || pagedata.isorder.status==6 || !pagedata.isorder.id)" class="title" style="color:#f60;font-size:0.7rem;margin-top:0;font-width:bold" id="wait_min">{{second}}</div>
				<div ng-if="!pagedata.isjiedan && (pagedata.isorder.status==0 || pagedata.isorder.status==6 || !pagedata.isorder.id)" class="title" style="text-align: center;color:#f60;font-size:0.7rem">正在等待网点接单...</div>
				<div ng-if="(pagedata.isorder.status!=0 && pagedata.isorder.status!=6) || pagedata.isjiedan" class="title" style="text-align: center;color:#f60;font-size:0.7rem">{{pagedata.isjiedan?'网点已接单...':'您有订单进行中...'}}</div>
			</div>
			<button ng-if="!pagedata.isjiedan && (pagedata.isorder.status==0 || pagedata.isorder.status==6 || !pagedata.isorder.id) && !pagedata.second" class="weui_btn weui_btn_primary" style="background:#cdab6a;line-height:2.8;margin: auto;margin-top:1.5rem;width:60%;font-size: 0.75rem;" ng-click="pagedata.callwait()">重新呼叫</button>
			<!--<button ng-if="!isjiedan && (pagedata.isorder.status==0 || pagedata.isorder.status==6 || !pagedata.isorder.id)" class="weui_btn weui_btn_disabled weui_btn_default" style="line-height:2.8;margin: auto;margin-top:0;width:60%;font-size: 0.75rem;color:#04be02" bindtap="closeorder">取消订单</button>-->
			<button ng-if="(pagedata.isorder.status!=0 && pagedata.isorder.status!=6) || pagedata.isjiedan" class="weui_btn weui_btn_primary" style="background:#cdab6a;line-height:2.8;margin: auto;margin-top:1.5rem;width:60%;font-size: 0.75rem;" ng-click="access_json('jy_mapfuwu/order//id='+pagedata.isorder.id);">查看订单</button>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('shop/_serves')"></div>
<div ng-include="sys_html('shop/_goodsitem')"></div>
<div ng-include="sys_html('_footer')"></div>
<div ng-include="sys_html('common/_xieyi',true)"></div>
<script>
window.scope.location(function(re){
		//console.log(re);
		if(re.lat_lng){
			scope.pagedata.pcd=re.addressComponents;
			scope.pagedata.pcd.street=scope.pagedata.pcd.street_recommend?scope.pagedata.pcd.street_recommend:scope.pagedata.pcd.street;
			scope.pagedata.addressinfo.title=scope.pagedata.pcd.street;
			var query=scope.made_query(scope.pagedata.pcd);
			query+='&'+'lat='+re.lat_lng.lat+'&lng='+re.lat_lng.lng+'&city='+re.lat_lng.lng;
			scope.get('jy_weishop/store.index/getlist/islocation=1&'+query,function(res){
				scope.pagedata.selectstore = res.stores?res.stores[0]:{};
				scope.$evalAsync();
			});
		}
});
scope.pagedata.callwait=function(){
	scope.pagedata.second=1;
	scope.message('呼叫成功！');
	scope.$evalAsync();
}
scope.pagedata.fuwupost=function(){
		//console.log('post');console.log(scope.pagedata.post)
		scope.post_json('jy_mapfuwu/index/create/',scope.pagedata.post,function(res){
			scope.pagedata.order_id=res.order_id
			var success_url='jy_mapfuwu/order/';
			scope.tool.pay(res.pay_id,function(res){
				if(res.type=='success'){
					scope.message('支付成功！','success',success_url);
				}else{
					scope.message('支付失败！','success',success_url);
				}
			},'','',success_url,success_url);
		});
}
</script>